﻿<Window x:Class="SBServer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:aero="clr-namespace:Common.AeroGlass;assembly=Common"
        aero:GlassEffect.IsEnabled="True" 
        MouseLeftButtonDown="Window_MouseLeftButtonDown"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="SBServer" Height="303" Width="538">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <GroupBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
            <GroupBox.Header>
                <CheckBox Content="Stopped" IsChecked="{Binding ServerStopped}" />
            </GroupBox.Header>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="5"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="5" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="5" />
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <Label Grid.Row="0" Grid.Column="0" Content="Name: " 
                       IsEnabled="{Binding ServerStopped}" />
                <TextBox Grid.Row="0" Grid.Column="2" 
                         Text="{Binding ServerName}" IsEnabled="{Binding ServerStopped}" />

                <Label Grid.Row="2" Grid.Column="0" Content="Port: " 
                       IsEnabled="False" />
                <TextBox Grid.Row="2" Grid.Column="2" 
                         Text="25125" IsEnabled="False" />

                <CheckBox Grid.Row="4" Grid.Column="2" Content="Discoverable" HorizontalAlignment="Left"
                          IsChecked="{Binding ServerDiscoverable}" IsEnabled="{Binding ServerStopped}"  />
            </Grid>
        </GroupBox>
        
        <Label Grid.Row="1" Grid.Column="0" Content="Log: " 
               HorizontalAlignment="Left" />
        <CheckBox Grid.Row="1" Grid.Column="1" Content="Auto scroll" IsChecked="{Binding AutoScroll}" 
                  HorizontalAlignment="Right" VerticalAlignment="Center"/>

        <ListView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding Log}" Name="lvwLog">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Timestamp" DisplayMemberBinding="{Binding Time}" />
                    <GridViewColumn Header="Session Id" DisplayMemberBinding="{Binding Id}" />
                    <GridViewColumn Header="User name" DisplayMemberBinding="{Binding Name}" />
                    <GridViewColumn Header="Content" DisplayMemberBinding="{Binding Content}" />
                </GridView>
            </ListView.View>
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Left" />
                    <Setter Property="VerticalContentAlignment" Value="Top"/>
                </Style>
            </ListView.ItemContainerStyle>
        </ListView>
    </Grid>
</Window>
